<template>
    <div>
        <el-table
                :data="tableData"
                stripe
                style="width: 100%"
                :height="getWinHeight"
                :row-style="{cursor:'pointer'}"
                highlight-current-row
        >
            <el-table-column
                    prop=""
                    label=""
                    width="20"
            >
            </el-table-column>
            <el-table-column
                    prop="id"
                    label="ID"
                    width="100"
                    >
            </el-table-column>
            <el-table-column
                    label="金额"
                    width="120"
                    >
                <template scope="scope">
                    <span v-if="scope.row.type==2">-</span>
                    <span v-if="scope.row.type==1">+</span>
                    <span>{{scope.row.price}}</span>
                </template>
            </el-table-column>
            <el-table-column
                    label="类型"
                    width="120"
            >
                <template scope="scope">
                    <el-tag type="danger" size="mini" v-if="scope.row.type==2">支出</el-tag>
                    <el-tag type="success" size="mini" v-if="scope.row.type==1">收入</el-tag>
                </template>
            </el-table-column>
            <el-table-column
                    prop="date"
                    label="日期"
                    width="200"
                    >
            </el-table-column>
            <el-table-column
                    prop="log"
                    label="收入来源"
                    >
            </el-table-column>
        </el-table>
    </div>
</template>

<script>
    export default {
        name: "incomeTable",
        props:['tableData'],
        computed:{
            getWinHeight(){
                let winHeight = document.body.clientHeight;
                return winHeight - 260
            }
        }
    }
</script>

<style scoped>

</style>
